/**
 * 
 */
package saima;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * 用圆心度表示距离
 * 
 * @author zhongfang
 *
 */
public class 圆周上两点的距离 {
	/**
	 * 用指针法
	 * @param a 已经排序的数组
	 * @return 最大距离角度
	 */
	double findMaxDistance(double[] a){
		int j=0;
		double max=0;
		for (int i=1; i < a.length; i++) {
			while(a[i]-a[j]>180){
				j++;
			}
			if(j!=0){
				max=Math.max(max,a[i]-a[j-1]);
			}
			max=Math.max(max,a[i]-a[j]);
		}
		return max;
	}

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		double a[] = new double[n];
		for (int i = 0; i < n; i++) {
			a[i] = Double.parseDouble(br.readLine());
		}
		double max = 0;
		Arrays.sort(a);
		// 搜索
		for (int i = 0; i < n; i++) {
			// 找到对面的
			double target = a[i] + 180;
			if (target > 360) {
				target -= 360;
			}
			int index = Arrays.binarySearch(a, target);
			if (index > 0) {
				System.out.println(a[i]+" "+target);
				max = 180;
				break;
			}
			index = -index - 1;// 插入位置
			if (index < n) {
				double diff1 = Math.abs(a[index] - a[i]);// >target
				if (diff1 > 180) {
					diff1 = 360 - diff1;
				}
				if (max < diff1) {
//					System.out.println(a[i]+" "+a[index]+" "+diff1);
					max = diff1;
				}
			}
			if (index != 0) {
				index--;
				double diff2 = Math.abs(a[index] - a[i]);
				if (diff2 > 180) {
					diff2 = 360 - diff2;
				}
				if (max < diff2) {
//					System.out.println(a[i]+" "+a[index]+" "+diff2);
					max = diff2;
				}
			}
		}
		System.out.println(String.format("%.08f", max));
	}
}
